package com.itmaster;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;

/**
 * @author fernando.perez
 */
public class DashboardActivity extends Activity {

	public static final String USER_EXTRA_VALUE = "user.extra.value";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.activity_dashboard);
		
		findViewById(R.id.newsListButton).setOnClickListener(new OnClickListener() {

			/*
			 */
			@Override
			public void onClick(View v) {
				startActivity(new Intent(DashboardActivity.this, NewsListActivity.class));
			}
		});
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		MenuInflater inflater = getMenuInflater();
	    inflater.inflate(R.menu.menu, menu);

		return super.onCreateOptionsMenu(menu);
	}
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		
		switch (item.getItemId()) {
		case R.id.action_logout:
			finish();
			startActivity(new Intent(this, LoginActivity.class));
			break;

		default:
			break;
		}

		return true;
	}
}
